package com.typhoon.config

import com.alibaba.druid.pool.DruidDataSource
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.PropertySource
import javax.sql.DataSource

@Configuration
@PropertySource(value = "classpath:druid.properties")
class DruidConfig {

    @Bean(destroyMethod = "close", initMethod = "init", name = arrayOf("dataSource"))
    @ConfigurationProperties(prefix = "spring.datasource")
    fun druidDataSource(): DataSource {
        return DruidDataSource()
    }

}